package com.jrx.anytxn.param.mapper.ext;

import com.jrx.anytxn.common.annotation.ParamTuningAnnotation;
import com.jrx.anytxn.param.entity.PrSmsSendingRules;
import com.jrx.anytxn.param.mapper.base.PrSmsSendingRulesMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname ExtPrSmsSendingRulesMapper
 * @Description lbz
 * @Date 2019/12/5
 * @author lbz
 */
@Service
public interface ExtPrSmsSendingRulesMapper extends PrSmsSendingRulesMapper {

    /**
     * 根据租户ID和规则ID查询信息
     *
     * @param tenantId  租户ID
     * @param rulesId 短信规则id
     * @return PrSmsSendingRules
     * @author lbz
     * date: 2019/12/6
     */
    PrSmsSendingRules selectByTenantIdAndRulesId(@Param("tenantId") String tenantId, @Param("rulesId") String rulesId);

    /**
     * 根据字段查询
     *
     * @param rulesId,organizationId,tenantId,ValidStatus
     * @return PrSmsSendingRules
     */
    PrSmsSendingRules selectByRulesIdAndOrgIdAndTenantIdAndValidStatus(@Param("rulesId") String rulesId, @Param("organizationId") String organizationId, @Param("tenantId") String tenantId,@Param("validStatus") String validStatus);

    /**
     * 根据以下条件查询
     * @author fan.yang
     * date: 2020/7/22 0022 下午 15:20
     * @param tenantId 租户ID
     * @param organizationId 机构ID
     * @param smsType 短信类型
     * @param templateId 模板ID
     * @param productId 产品ID
     * @return com.jrx.anytxn.param.entity.PrSmsSendingRules
     */
    PrSmsSendingRules selectByProductIdAndSmsTypeAndTempId(@Param("tenantId") String tenantId,@Param("organizationId") String organizationId, @Param("smsType") String smsType, @Param("templateId") String templateId,@Param("productId") String productId,@Param("reminderCycle") Integer reminderCycle);


    /**
     * 根据请求req查询模板信息
     *
     * @param prSmsSendingRules 查询请求req
     * @return List<PrSmsSendingRules>
     * @author lbz
     * date: 2019/12/6
     */
    List<PrSmsSendingRules> selectByCondition(PrSmsSendingRules prSmsSendingRules);

    /**
     * 根据租户ID查询查询模板信息
     *
     * @param tenantId 租户ID
     * @return List<PrSmsSendingRules>
     * @author lbz
     * date: 2019/12/6
     */
    List<PrSmsSendingRules> selectByTenantId(@Param("tenantId") String tenantId, @Param("rulesId") String rulesId);

    /**
     * 更新模板信息
     * @param PrSmsSendingRules 短信规则参数信息
     * @return int
     * @author lbz
     * date: 2019/12/6
     */
    @ParamTuningAnnotation
    int updateByTenantIdAndRulesId(PrSmsSendingRules PrSmsSendingRules);

    /**
     * 删除信息
     *
     * @param tenantId 租户ID
     * @param rulesId  短信规则编号
     * @return int
     * @author lbz
     * date: 2019/12/6
     */
    @ParamTuningAnnotation
    int deleteByTenantIdAndRulesId(@Param("tenantId") String tenantId, @Param("rulesId") String rulesId);


    /**
     * 根据字段查询
     *
     * @param productId,smsType,sumStatus
     * @return PrSmsSendingRules
     */
    PrSmsSendingRules selectByProductIdAndSmsTypeAndSumStatus(@Param("productId") String productId, @Param("smsType") String smsType,@Param("sumStatus") String sumStatus,@Param("tenantId") String tenantId);


    /**
     * 获取短信类型的发送规则
     *
     * @param smsTypeList
     * @return PrSmsSendingRules
     */
    List<PrSmsSendingRules> selectBySmsType(@Param("smsTypeList") List<String> smsTypeList);

}
